import fetch from '@/utils/fetch'

export function apiGetStaffList(listQuery) {
  return fetch({
    url: '/api/v1/staff/list',
    method: 'get',
    params: listQuery
  })
}

export function apiGetStaffById(staffId) {
  return fetch({
    url: '/api/v1/staff',
    method: 'get',
    params: {
      id: staffId
    }
  })
}

export function apiAddStaff(staffDto) {
  return fetch({
    url: '/api/v1/staff',
    method: 'post',
    data: staffDto
  })
}

export function apiUpdStaff(staffDto) {
  return fetch({
    url: '/api/v1/staff',
    method: 'put',
    data: staffDto
  })
}

export function apiDelStaff(staffId) {
  return fetch({
    url: '/api/v1/staff',
    method: 'delete',
    params: {
      id: staffId
    }
  })
}

export function apiExport (listQuery) {
  return fetch({
    url: '/api/v1/staff/export',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
